package cn.tedu.collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

public class SortDemo {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        list.add(3);
        list.add(4);
        list.add(2);
        list.add(5);
        Collections.sort(list);

        Comparator<? super Integer> c = new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o1-o2;
            }
        };
        Comparator<? super Integer> c1 = (o1,o2)->{return o1-o2;};

        Comparator<? super Integer> c2 = (o1,o2)-> o1-o2;
        Collections.sort(list,c);
    }
}
